<template lang="pug">
.we_main_box
    navs
    .details_main-list.m-auto.page-w
        .banner-box {{current.headline}}
        .details-box.p-lr100(v-loading='loadingObj.page')
            .l
                .headline {{ result.list.title }}
                .source.p-t10 
                    template(v-if="result.list.source") 来源：{{ result.list.source }} 
                    template(v-if="result.list.sendTime") &nbsp;&nbsp;&nbsp;发布时间：{{formatTimeFn(result.list.sendTime) }}
                div.box_img(v-html="result.list.content")
            .r(v-if="false")
                ul
                    li
                        p 新闻中心
                    template(v-for="(n, index) in result.rightList")
                        li.cursor(:key='index' @click="toPageDetails(n)") {{ n.title }}
</template>
<script>
import Navs from './../../components/nav.vue';
import Utils from "../../utils/index.js";
export default {
    data () {
        return {
            loadingObj: {
                page: true
            },
            current: {
                headline: '新闻中心'
            },
            
            
            result: {
                list: {},
                rightList: []

            }
        };
    },
    components: {
        Navs
    },
    mounted() {
        let {headline = '新闻中心' } = this.$route.query;
        this.current.headline = headline;
        this.info();
        this.getindustryNews();
        
        // current
    },
    methods: {
        formatTimeFn(val) {
            return Utils.formatTime(val, "YYYY-MM-DD");
        },
        toPageDetails (n) {
            let {id} = n;
            this.$router.push({path: '/details?id=' + id});
        },
        // 新闻概览
        getindustryNews() {
            let params = {
                category: "industry_news",
            };
            this.axios
                .post(
                    "/ctepapi/admin-api/system/article-open/news/page",
                    params,
                    { headers: { "Content-Type": "application/json" } }
                )
                .then((resp) => {
                    let { errno, errmsg, data } = resp.data;
                    if (errno * 1 !== 0) {
                        let { list } = data;
                        this.result.rightList = list;
                    }
                });
        },
        info() {
            this.loadingObj.page = true;
            let {id} = this.$route.query;
            let params = {
                id
            };
            this.axios.get("/ctepapi/admin-api/system/article-open/get", {
                params
            }).then((resp) => {
                let { errno, errmsg, data } = resp.data;
                if (errno * 1 !== 0) {
                    this.result.list = data;
                    this.loadingObj.page = false;
                } else {
                    this.$message.error(errmsg);
                }
            });
        }
    }
};
</script>
<style scoped>
.box_img >>> img {
    max-width: 100%;
    object-fit: fill;
}
.box_img {
    margin-bottom: 25px;
    color: #000;
    padding: 0 10px;
    line-height: 1.8;
    font-size: 16px;
}
</style>
<style lang="sass" scoped>
    .details_main-list
        // font-family: PingFangSC-Medium, PingFang SC
        font-size: initial
        .assistant-headline
            font-size: 18px
        .details-box
            // img
            //     width: 100%
            //     object-fit: fill
            margin-top: 37px
            display: flex
            padding-bottom: 20px
            // img
            //     width: 100%
            //     // border: 1px solid #DDDDDD
            //     border: 2px solid red !important
            // .l >>> img 
            //     max-width: 100%
            //     border: 2px solid red !important
            .l
            

                // flex: 1
                display: block
                width: 100%
                overflow: hidden
                
                p
                    text-indent: 2em
                    font-size: 16px
                    font-weight: 400
                    line-height: 28px
                    color: #333333
                .headline
                    font-size: 26px
                    font-weight: 500
                    color: #333333
                    text-align: center
                .source
                    font-size: 14px
                    font-weight: 400
                    color: #666666
                    margin-bottom: 20px
                    text-align: center
                    span
                        color:#333333
                        padding-right: 30px
            .r
                width: 280px
                ul
                    
                    border: 1px solid #EEEEEE
                    li
                        border-bottom: 1px solid #EEEEEE
                        font-size: 16px
                        color: #333333
                        padding: 16px 18px
                        &:first-child
                            padding: 0
                            p
                                background: url(./../images/xwzxbj.png) no-repeat center center
                                background-size: 100% 100%
                                line-height: 162px
                                text-align: center
                                font-size: 26px

                                font-weight: 500
                                color: #FFFFFF
                            
                        &:last-child
                            border: none
</style>